<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Kalnoy\Nestedset\NestedSet;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('id');
            NestedSet::columns($table);
            $table->string('avatar')->nullable()->default(null)->comment('头像');
            $table->string('username')->unique()->comment('用户名');
            $table->string('email')->nullable()->default(null)->comment('邮箱');
            $table->string('area', 64)->nullable()->default(null)->comment('区号');
            $table->string('mobile', 64)->nullable()->default(null)->comment('手机号');
            $table->string('password')->nullable()->default(null)->comment('登录密码');
            $table->string('pay_password')->nullable()->default(null)->comment('支付密码');
            $table->unsignedTinyInteger('vip_level')->default(0)->comment('用户等级:0-普通节点 1-初级节点 2-中级节点 3-高级节点');
            $table->unsignedTinyInteger('admin_level')->default(0)->comment('管理员指定等级:0-普通节点 1-初级节点 2-中级节点 3-高级节点');
            $table->unsignedTinyInteger('status')->nullable()->default(0)->comment('状态:0.正常 1.禁用');
            $table->unsignedTinyInteger('active_status')->nullable()->default(0)->comment('激活状态:0.未激活 1.已激活');
            $table->unsignedTinyInteger('withdraw_switch')->nullable()->default(0)->comment('提币黑名单:0.正常 1.禁止提币');
            $table->unsignedTinyInteger('profit_switch')->nullable()->default(0)->comment('静态收益结算开关:0.开启结算 1.关闭结算');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
